#pragma once

#include <iostream>
#include <string>
#include <stdarg.h>
enum Level
{
    Debug = 0,
    Info,
    Warning,
    Error,
    Fatal
};

std::string LevelToString(int level)
{
    switch (level)
    {
    case 0:
        return "Debug";
    case 1:
        return "Info";
    case 2:
        return "Warning";
    case 3:
        return "Error";
    case 4:
        return "Fatal";

    default:
        return "Unknow";
    }
}
class Log
{
public:
    Log()
    {
    }
    void LogMessage(int Level, const char *format, ...)
    {
        char content[1024];
        va_list arg;

        va_start(arg, format); // 将arg指向可变参数

        vsnprintf(content, sizeof(content), format, arg);

        va_end(arg);
        uint64_t curtime = time(nullptr);
        printf("[%s],[%s],[%s]", LevelToString(Level).c_str(), content, std::to_string(curtime).c_str());
    }
    ~Log()
    {
    }
};

Log lg;